<?php

include_once ("common.php");

function wholesale_2($fromUsername,$toUsername)
{
    //logWrite(  " im  in wholesale 2 ..") ;
    $textTpl = "<xml>
                    <ToUserName><![CDATA[%s]]></ToUserName>
                    <FromUserName><![CDATA[%s]]></FromUserName>
                    <CreateTime>%s</CreateTime>
                    <MsgType><![CDATA[%s]]></MsgType>
                    <Content><![CDATA[%s]]></Content>
                    <FuncFlag>0</FuncFlag>
                    </xml>";

    $msgType = "text";    //定义响应消息类型text

    $contentStr = "如何批发价拿货？";

    $responseStr = sprintf($textTpl, $fromUsername, $toUsername, time(), $msgType, $contentStr);

     //logWrite("wholesale_2=" .$responseStr ) ;

    echo $responseStr;
}




function wholesale($object)
{
    //logWrite(  " im  in wholesale ..") ;

    $content = array();
    $content[] = array("Title"=>"如何批发价拿货？??",
    "Description" => "首先各位在询问小强（也就是我本人）的时候，请先咨询阅读这篇合作简章，如果你可以理解或者确定自己能做的话再来跟",
    "PicUrl"=>"http://mmbiz.qpic.cn/mmbiz/ZGNUlSAMpww9F8EaWIVLn2aWsQJXibticZdrZ4EyHAHjJIqRyQib3I2oKuR18aEo9dPflPzicY8TpGZBrGN5es6UMw/0?wx_fmt=jpeg",
    "Url" =>"http://mp.weixin.qq.com/s?__biz=MzA3NjM3MzUwNA==&mid=509554833&idx=1&sn=67d051fb78f4dfca3839f47c3c3036a4&chksm=04c9dbfe33be52e809293d310ad44655e3991a2e59239959c3306604b3565abd5b1fa9bf4bf4#rd"
    );

    if(is_array($content))
    {
        if (isset($content[0]['PicUrl']))
        {

              $result = transmitNews($object, $content);


                //logWrite("content=" .$content ) ;
                 //logWrite("result=" .$result ) ;
              echo  $result;
        }
    }

    return;
}


/*
function wholesale4($object)
{
    //logWrite(  " im  in wholesale ..") ;

     $imageTpl = "<xml>
						<ToUserName><![CDATA[toUser]]></ToUserName>
						<FromUserName><![CDATA[fromUser]]></FromUserName>
						<CreateTime>%s</CreateTime>
						<MsgType><![CDATA[news]]></MsgType>
						<ArticleCount>1</ArticleCount>
						<Articles>
						<Title><![CDATA[%s]]></Title>
						<Description><![CDATA[%s]]></Description>
						<PicUrl><![CDATA[%s]]></PicUrl>
						<Url><![CDATA[%s]]></Url>
						</item>
						</Articles>
						</xml> ";

               $title = "如何批发价拿货?";
                $Desc = "合作价格：以公众号报价(不加溢价）的方式出货";
				$PicUrl = "http://www.dreammm.net/uploads/allimg/141105/2-141105153459216-lp.png;
				$Url = "http://www.dreammm.net/gsjs/gsjs.html";
                $resultStr = sprintf($imageTpl,$object->FromUserName, $object->ToUserName, time(), $title, ,$Desc,$PicUrl, $Url);

                 logWrite( $resultStr );
                echo $resultStr;

}

*/

?>